package networkSimulation.simulation.social.monitor

import networkSimulation.framework.Graph
import networkSimulation.monitor.Monitor
import networkSimulation.simulation.social.framework._

/**
 * Monitor when the friendship groups
 *
 * @author  Tim Caljé
 *          Jeroen De Raedt
 *          Jorick Van Aken
 */
class FriendshipMonitor[Method, Pub](name : String,graph : Graph[Person, Friendship[Person]]) extends Monitor[Method, Pub, Person, Friendship[Person]](name, graph) {

  /**
   * Custom implementation of the reaction to a notification of a publishing event of a Publisher.
   */
  @Override
  def notify(pub: Pub,  event: Method) {
    val footballSize = this.graph.edges.filter(f => f.isInstanceOf[FootBall[Person]]).toList.size
    val gayCommunitySize = this.graph.edges.filter(f => f.isInstanceOf[GayCommunity[Person]]).toList.size
    val schoolSize = this.graph.edges.filter(f => f.isInstanceOf[School[Person]]).toList.size

    this.log("Size football group: " + footballSize)
    this.log("Size gay community: " + gayCommunitySize)
    this.log("Size school group: " + schoolSize)
  }

}